/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.hutech09.jsale.web.manager.supplier;

import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
import org.hutech09.jsale.bsn.ISupplierManager;
import org.hutech09.jsale.entity.Supplier;

/**
 *
 * @author Nam
 */
@ManagedBean
@RequestScoped
public class SupplierCreateCtrl {

    @EJB
    private ISupplierManager supplierMgr;

    private Supplier supplier = new Supplier();

    private Supplier createdSupplier;

    public SupplierCreateCtrl() {
    }

    public void create() {
        createdSupplier = supplierMgr.create(supplier);
        supplier = new Supplier();
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Saved!", ""));
    }

    public Supplier getSupplier() {
        return supplier;
    }

    public void setSupplier(Supplier supplier) {
        this.supplier = supplier;
    }
}
